using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;

namespace THANHTUNGO.Portal.Modules.NEWS.Components
{
    public partial class Item
    {
        public static DataSet SelectRelationItems(int id)
        {
            string spName = "p_NEWS_Item_SelectRelationItems";
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand(spName);
            db.AddInParameter(dbCommand, "@ItemID", DbType.Int32, id);
            return db.ExecuteDataSet(dbCommand);
        }

        public static DataSet SelectBy_ModuleID(int moduleID)
        {
            string spName = "p_NEWS_Item_SelectBy_ModuleID";
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand(spName);
            db.AddInParameter(dbCommand, "@ModuleID", DbType.Int32, moduleID);
            return db.ExecuteDataSet(dbCommand);
        }

        public static DataSet SelectBy_ModuleID_Status(int moduleID, string status)
        {
            string spName = "p_NEWS_Item_SelectBy_ModuleID_Status";
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetStoredProcCommand(spName);
            db.AddInParameter(dbCommand, "@ModuleID", DbType.Int32, moduleID);
            db.AddInParameter(dbCommand, "@Status", DbType.String, status);
            return db.ExecuteDataSet(dbCommand);            
        }
    }
}
